package br.com.jdobjs.core.mock;

import java.lang.reflect.Method;

import org.jboss.aop.joinpoint.MethodInvocation;

public class MethodInvocationMock extends MethodInvocation {

	private Method actualMethod;
	private Object targetObject;
	private Object[] args;

	public MethodInvocationMock(Method actualMethod, Object targetObject,
			Object... args) {
		super();
		this.actualMethod = actualMethod;
		this.targetObject = targetObject;
		this.args = args;
	}

	@Override
	public Method getActualMethod() {
		return actualMethod;
	}

	@Override
	public Object getTargetObject() {
		return targetObject;
	}

	@Override
	public Object[] getArguments() {
		return args;
	}

	@Override
	public Object invokeNext() throws Throwable {
		return actualMethod.invoke(targetObject, args);
	}
}
